
package GUI;

import gameStructure.playersChoice;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

public class messageBox extends JFrame{


    
    public messageBox() {
        
    final String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };
    final DefaultComboBoxModel model = new DefaultComboBoxModel(labels);

    JFrame frame = new JFrame("Shared Data");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    JPanel panel = new JPanel();
    JComboBox comboBox1 = new JComboBox(model);
    comboBox1.setMaximumRowCount(5);
    comboBox1.setEditable(true);

    JComboBox comboBox2 = new JComboBox(model);
    comboBox2.setMaximumRowCount(5);
    comboBox2.setEditable(true);
    panel.add(comboBox1);
    panel.add(comboBox2);
    contentPane.add(panel, BorderLayout.NORTH);

    JList jlist = new JList(model);
    JScrollPane scrollPane = new JScrollPane(jlist);
    contentPane.add(scrollPane, BorderLayout.CENTER);
    
    
    JTextField text = new JTextField(10);
    contentPane.add(text, BorderLayout.PAGE_START);
	String text2 = text.getText();
        text2="BLA";
        System.out.println("TEST IS:"+text2);
	String sent1 = "";
	JLabel label = new JLabel("Type a sentence so that I can fix it for you.");
        contentPane.add(label, BorderLayout.PAGE_START);
	JLabel fixed = new JLabel("--");
       

        
    JButton playButton = new JButton("Play");
    contentPane.add(playButton, BorderLayout.EAST);
    ActionListener playActionListener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        int index = (int) (Math.random() * labels.length);
        model.addElement("SKATA");
      }
    };
    playButton.addActionListener(playActionListener);
    
    JButton exitButton = new JButton("Exit");
    contentPane.add(exitButton, BorderLayout.SOUTH);
    ActionListener exitActionListener = new ActionListener() {
      public void actionPerformed(ActionEvent actionEvent) {
        int index = (int) (Math.random() * labels.length);
        model.addElement("SKATA");
      }
    };
    exitButton.addActionListener(exitActionListener);

    frame.setSize(300, 200);
    frame.setVisible(true);
        
        
//        setLayout( new FlowLayout());
//        JLabel Player1 = new JLabel("Player 1:");
//        add(Player1);
//        String [] choices = {"Randrom", "White","Black"};
//        final JComboBox combo = new JComboBox(choices);
//        combo.setMaximumRowCount(3);
//        add(combo);
//        JLabel Player2 = new JLabel("Player 2");
//        add(Player2);
//        
//        String [] pChoice = new String[2]; // pChoice[0] -> Player1, pChoice[1] -> Player2.
//        combo.addItemListener(
//                new ItemListener(){
//            public void itemStateChanged(ItemEvent event) {
//                /**
//                 * TODO tha "kali" ton constractora tis class playersChoice kai tha dini san isodo
//                 * to clr: ton arhiko haraktira tou hromatos pou epilexe o Player1
//                 * kai to name: pou ine ena 1D String me ta onomata ton Piece.
//                 */
//                
//            }
//                    
//                }
//        );
    }
    
    /**
     * TODO na boun ta buttons "Exit" kai "Play".
     */
}